{include file="public/head"}

<body>
	<div class="x-body">
		<form class="lotus-nav layui-form">
			<button type="button" class="layui-btn  layui-btn-sm" onclick="x_admin_show('添加活动','addAction.html',900,800)">添加
            </button>
			<div class="layui-input-inline">
				<select name="cate_id" lay-search>
					<option value="0">选择分类</option>
					{volist name="cateList" id="vo"}
					<option value="{$vo.id}" {eq name="$Think.get.cate_id" value="$vo.id" }selected{/eq}>{$vo.name}</option>
					{/volist}
				</select>
			</div>
			<div class="layui-input-inline">
				<input id="" name="keyword" class="layui-input lotus-input" placeholder="请输入关键词搜索" value="{$Think.get.keyword}">
			</div>
			<button class="layui-btn layui-btn-sm"><i class="layui-icon layui-icon-search"></i></button>
			<!--<button type="button" class="layui-btn layui-btn-sm" onclick="location='/admin/Admin/index'">重置</button>-->
			<span class="x-right">共有数据:<i class="i_count">{$list->total()}</i>条 <button onclick="javascript:location.reload()" class="layui-btn-default "><i class="layui-icon layui-icon-refresh"></i></button></span>
		</form>
		<table class="layui-table">
			<thead>
				<tr>
					<th>ID</th>
					<th>活动名称</th>
					<th>分类</th>
					<!--<th>权重</th>-->
					<th>参与次数</th>
					<th>每人每天可参与次数</th>
					<th>开始时间</th>
					<th>结束时间</th>
					<th>创建时间</th>
					<th>状态</th>
					<th>操作</th>
			</thead>
			<tbody>
				{volist name="list" id="vo"}
				<tr>
					<td>{$vo.id}</td>
					<td>{$vo.title}</td>
					<td>{$vo.name}</td>
					<!--<td>{$vo.rank}</td>-->
					<td>{$vo.join_number}</td>
					<td>{$vo.join_eachday}</td>
					<td>{$vo.starttime}</td>
					<td>{$vo.endtime}</td>
					<td>{$vo.createtime}</td>
					<td>
						{eq name="$vo.status" value="1"}正常{else/}禁用{/eq}
					</td>
					<td>
						<button class="layui-btn layui-btn-xs" onclick="x_admin_show('{$vo.title} -> 编辑活动','editAction.html?id={$vo.id}',900,800)">编辑</button>
						<button class="layui-btn layui-btn-xs" onclick="x_admin_show('{$vo.title} -> 广告配置','/admin/banner/index.html?id={$vo.id}',900,800)">广告配置</button>
						<!--<button class="layui-btn layui-btn-xs" data-method="offset" data-link="{:Request()->domain()}/index/Index/coupons?actionid={$vo.id}">生成链接</button>-->
						<button class="layui-btn layui-btn-xs" onclick="x_admin_show('{$vo.title} -> 券配置','/admin/Coupon/index.html?id={$vo.id}',900,800)">券配置</button>
						<button class="layui-btn layui-btn-xs" onclick="x_admin_show('{$vo.title} -> 统计','/admin/Actionstat/index.html?id={$vo.id}',900,800)">统计</button>
						<!--<button onclick="delUser(this,'{$vo.id}')" class="layui-btn layui-btn-xs layui-btn-danger">删除</button>-->
					</td>
				</tr>
				{/volist}
			</tbody>
		</table>
		<div class="page">
			<div>
				{$list|raw}
			</div>
		</div>
	</div>
</body>
{include file="public/foot"}
<script>
	layui.use('layer', function() { //独立版的layer无需执行这一句
		var $ = layui.jquery,
			layer = layui.layer; //独立版的layer无需执行这一句

		//触发事件
		var active = {
			offset: function(othis) {
				var link = othis.data('link');

				layer.open({
					type: 1,
					area: ["420px", "240px"],
					offset: 'auto',
					id: 'layerDemoauto' //防止重复弹出
						,
					content: '<div style="padding: 20px 20px;"><textarea class="layui-textarea" id="link" readonly>' + link + '</textarea></div>',
					btn: '复制',
					btnAlign: 'c' //按钮居中
						,
					shade: 0 //不显示遮罩
						,
					yes: function() {
						var Url2 = document.getElementById("link");
						Url2.select(); // 选择对象
						document.execCommand("Copy"); // 执行浏览器复制命令
						layer.closeAll();
					}
				});
			}
		};

		$('.layui-btn').on('click', function() {
			var othis = $(this),
				method = othis.data('method');
			active[method] ? active[method].call(this, othis) : '';
		});

	});
</script>